<?php 
require_once('Class/connexionDB.Class.php');

class notification
{
	var $nb 				= 0;
	var $listedNotification = array();

	/**
		Return condenced rating data by id_account
		2 == Manager 
		3 == Chargé de qualité
	*/
	function getRatingForNotification($id_account, $id_accountType, $group)
	{
		$db = new connexionDB();

		// Account type = manager
		if ($id_accountType == 2)
		{
			$groups = explode(';', $group);
			foreach ($groups as $value)
			{
				$group_name = $db->getGroupNameByID($value);
				if (isset($group_name[0]['name']))
				{
					$group_name = $group_name[0]['name'];
					$this->listedNotification[] = $db->getRatingForNotification($group_name);
				}
			}			
		}
		else
		{
			// Notifications for admin or "Responsible Quality"
			$this->listedNotification[] = $db->getRatingForNotificationAnswered($id_account);
		}

		return $this->listedNotification;
	}
}

?>